Systems, methods, and devices for managing data skew in a join operation

ABSTRACT

Systems, methods, and devices, for managing data skew during a join operation are disclosed. A method includes computing a hash value for a join operation and detecting data skew on a probe side of the join operation at a runtime of the join operation using a lightweight sketch data structure. The method includes identifying a frequent probe-side join key on the probe side of the join operation during a probe phase of the join operation. The method includes identifying a frequent build-side row having a build-side join key corresponding with the frequent probe-side join key. The method includes asynchronously distributing the frequent build-side row to one or more remote servers.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a Continuation of U.S. patent application Ser. No.16/005,182, filed on Jun. 11, 2018, the contents of which areincorporated by reference herein in their entirety.

TECHNICAL FIELD

The present disclosure relates to database query processing and moreparticularly relates to managing data skew in database a join operation.

BACKGROUND

Databases are widely used for data storage and access in computingapplications. Databases may include one or more tables that include orreference data that can be joined, read, modified, or deleted usingqueries. Databases can store small or extremely large sets of datawithin one or more tables. This data can be accessed by various users inan organization or even be used to service public users, such as via awebsite or an application program interface (API). Both computing andstorage resources, as well as their underlying architecture, can play asignificant role in achieving desirable database performance.

A join operation may be conducted on database data and cause columnsfrom one or more database tables to be merged. Relational databases areoften normalized to eliminate duplication of information such as when anentity type may have one-to-many relationships with a plurality of otherentity types. A join operation may be utilized to join entity typesaccording to certain join predicates. A join operation may be utilizedin response to a database query to return the appropriate entity typesthat are requested in the query.

BRIEF DESCRIPTION OF THE DRAWINGS

Non-limiting and non-exhaustive implementations of the presentdisclosure are described with reference to the following figures,wherein like reference numerals refer to like or similar partsthroughout the various views unless otherwise specified. Advantages ofthe present disclosure will become better understood with regard to thefollowing description and accompanying drawings where:

FIG. 1 is a block diagram illustrating a processing platform for adatabase system according to an example embodiment of the systems andmethods described herein;

FIG. 2 is a block diagram illustrating components of a database servicemanager, according to an example embodiment of the systems and methodsdescribed herein;

FIG. 3 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 4 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 5 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 6 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 7 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 8 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 9 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 10 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 11 is a schematic diagram illustrating an example join operationaccording to an embodiment of the disclosure;

FIG. 12 is a schematic flow chart diagram of an example process flow fordetecting and managing probe-side skew during a join operation,according to an embodiment of the disclosure;

FIG. 13 is a schematic flow chart diagram of an example process flow fordetecting skew during a join operation, according to an embodiment ofthe disclosure;

FIG. 14 is a schematic flow chart diagram of a process flow for heavyhitter redistribution, according to an embodiment of the disclosure;

FIG. 15 illustrates a schematic block diagram of a process flow forquery processing, according to an embodiment of the disclosure;

FIG. 16 illustrates a schematic flow chart diagram of a method formanaging probe-side skew during a join operation, according to anembodiment of the disclosure;

FIG. 17 illustrates a schematic flow chart diagram of a method formanaging probe-side skew during a join operation, according to anembodiment of the disclosure; and

FIG. 18 is a schematic diagram of an example computing device, accordingto an embodiment of the disclosure.

DETAILED DESCRIPTION

Databases are widely used for data storage and access in computingapplications. Databases may include one or more tables that include orreference data that can be read, modified, or deleted using queries.Querying very large databases and/or tables might require scanning largeamounts of data. Reducing the amount of data scanned is one of the mainchallenges of data organization and processing.

A join is an operation in query processing that determines rows in twoinput streams that “match” with respect to some of their attributes. Inan embodiment, those attributes are referred to as join keys. Joinoperations are typically very time-consuming operations during queryexecution. A known embodiment of a join operation includes a SQL joinclause for combining columns from one or more tables in a relationaldatabase. The join clause is a means for combining columns from one ormore tables by using values common to each of the one or more tables.

A hash join is an example of a join algorithm that may be used in theimplementation of a relationship database management system. Variousforms of hash joins are commonly used in database systems to compute theresult of a join. Hash joins build one or more multiple hash tables withrows of one of the inputs (typically the smaller input) referred to asthe “build side” input. The rows are probed from the other input(typically the larger input) referred to as the “probe side” input andinto the hash tables. In massively parallel database systems with Nservers, two distribution strategies are often distinguished: broadcastjoins and hash-hash joins (hash-hash-joins are also commonly referred toas shuffle joins).

A broadcast join is an example of a join algorithm where a single sideof the data to be joined is materialized and sent to a plurality ofworkers or servers. Broadcast joins are efficient when the build sideinput fits into a main memory of a single server. Broadcast joinsdistribute all rows of the build side to all N servers and then hashpartition the probe side over the servers such that each server of the Nservers receives only a fraction of the probe side input. Each of the Nservers probes its partition into its copy of the hash table wherein itscopy of the hash table includes all data from the build side input.

Hash-hash joins are often employed where the build side input does notfit into a main memory of a single server. Hash-hash joins areconfigured to hash-partition the build side input across all N serversand then hash-partition the probe side input with the same partitioningfunction. In a hash-hash join, each server of the N servers probes itsfraction of the probe side input into its fraction of the build side.The partitioning function ensures that if a row from probe partitionPP_(i) has matches in the build side, those matches are in buildpartition BP_(i). This leads to equal utilization of all N participatingservers during the probe phase of the hash-hash join, if an only if thepartitioning function partitions the probe input into N partitions ofequal size. In particular, if one server receives a disproportionatelylarge amount of probe side data, it will take much longer than the restof the servers to process its share of the probe side. This can stallthe rest of the query execution. This is often caused by a fewfrequently occurring join keys on the probe side wherein some rows onthe build side will match many rows on the probe side. This is referredto as probe-side skew.

In light of the foregoing, Applicant has developed systems, methods, anddevices for managing data skew in a join operation, and particularly formanaging probe-side data skew in a relational database join operation.An embodiment of the disclosure relates to redirecting a portion of ajoin operation to one or more other servers or computing devices. In anembodiment, a server or computing device that has been tasked with ajoin operation detects data skew on the join operation in real-timeduring runtime of the join operation. The server determines a frequentor heavy hitter join key on a probe side of the join operation. Theserver identifies a frequent or heavy hitter build-side row thatcomprises an equivalent value to the frequent join key on the probe sideof the join operation. The server then distributes the frequentbuild-side row (it should be appreciated this may include many thousandsof rows, for example) to one or more other servers or computing devices.The one or more other servers or computing devices are configured toreceive the frequent build-side rows and process the join operation forthose frequent build-side rows. The final result of the join operationis then a combination of the processing done by the local host serverand any other servers that received a portion of the join operation. Inan embodiment, the join operation is processed by a plurality of serverssuch that the join operation may be efficiently and quickly processedwithout burdening a single server with the join operation.

An embodiment of the disclosure includes a method for managing data skewin a join operation. The method includes computing a hash value for ajoin operation and detecting data skew on a probe side of the joinoperation at a runtime of the join operation using a lightweight sketchdata structure. The method includes identifying a frequent probe-sidejoin key on the probe side of the join operation during a probe phase ofthe join operation. The method includes identifying a frequentbuild-side row having a build-side join key corresponding with thefrequent probe-side join key. The frequent build-side row may comprisemany rows having a certain join key on the build side, and/or thefrequent build-side row may comprise many join partners on the probeside. The method includes asynchronously distributing the frequentbuild-side row to one or more remote servers.

In an embodiment of the disclosure, a method for managing data skewduring a join operation is disclosed. The method includes computing ahash value for a join operation, and the hash value may comprise a hashtable. The method includes selecting a rowset comprising a plurality ofrows of the join operation and probing each of the plurality of rows ofthe rowset into a space saving algorithm using the hash value for thejoin operation. The method includes updating the space saving algorithmbase on incoming data, wherein the incoming data includes probe siderowsets. The method includes, for each update to the space savingalgorithm, identifying a frequency indicating how frequently a frequentprobe-side join key is probed as a side-effect of the updating the spacesaving algorithm. The method includes determining if the frequencyexceeds a predetermined threshold. The method includes identifying afrequent build-side row having a build-side join key corresponding withthe frequent probe-side join key. The method includes, in response tothe frequency exceeding the predetermined threshold, asynchronouslydistributing the frequent build-side row to the one or more remoteservers.

A detailed description of systems and methods consistent withembodiments of the present disclosure is provided below. While severalembodiments are described, it should be understood that this disclosureis not limited to any one embodiment, but instead encompasses numerousalternatives, modifications, and equivalents. In addition, whilenumerous specific details are set forth in the following description inorder to provide a thorough understanding of the embodiments disclosedherein, some embodiments may be practiced without some or all of thesedetails. Moreover, for clarity, certain technical material that is knownin the related art has not been described in detail to avoidunnecessarily obscuring the disclosure.

Turning to FIG. 1, a block diagram is shown illustrating a processingplatform 100 for providing database services, according to oneembodiment. In one embodiment, the processing platform 100 may store andmaintain database tables using incremental cluster maintenance, asdiscussed herein. The processing platform 100 includes a databaseservice manager 102 that is accessible by multiple users 104, 106, and108. The database service manager 102 may also be referred to herein asa resource manager or global services. In some implementations, databaseservice manager 102 can support any number of users desiring access todata or services of the processing platform 100. Users 104-108 mayinclude, for example, end users providing data storage and retrievalqueries and requests, system administrators managing the systems andmethods described herein, software applications that interact with adatabase, and other components/devices that interact with databaseservice manager 102.

The database service manager 102 may provide various services andfunctions that support the operation of the systems and componentswithin the processing platform 100. Database service manager 102 hasaccess to stored metadata associated with the data stored throughoutdata processing platform 100. The database service manager 102 may usethe metadata for optimizing user queries. In some embodiments, metadataincludes a summary of data stored in remote data storage systems as wellas data available from a local cache (e.g., a cache within one or moreof the clusters of the execution platform 112). Additionally, metadatamay include information regarding how data is organized in the remotedata storage systems and the local caches. Metadata allows systems andservices to determine whether a piece of data needs to be processedwithout loading or accessing the actual data from a storage device.

As part of the data processing platform 100, metadata may be collectedwhen changes are made to the data using a data manipulation language(DML), which changes may be made by way of any DML statement. Examplesof manipulating data may include, but are not limited to, selecting,updating, changing, merging, and inserting data into tables. Table datafor a single table may be partitioned or clustered into variouspartitions. As part of the processing platform 100, files or partitionsmay be created, and the metadata may be collected on a per file, perpartition, and/or a per column basis. This collection of metadata may beperformed during data ingestion or the collection of metadata may beperformed as a separate process after the data is ingested or loaded. Inan implementation, the metadata may include a number of distinct values;a number of null values; and a minimum value and a maximum value foreach file, partition, or column. In an implementation, the metadata mayfurther include string length information and ranges of characters instrings.

Database service manager 102 is further in communication with anexecution platform 112, which provides computing resources that executevarious data storage and data retrieval operations. The executionplatform 112 may include one or more compute clusters. The executionplatform 112 is in communication with one or more data storage devices116, 118, and 120 that are part of a storage platform 114. Althoughthree data storage devices 116, 118, and 120 are shown in FIG. 1, theexecution platform 112 is capable of communicating with any number ofdata storage devices. In some embodiments, data storage devices 116,118, and 120 are cloud-based storage devices located in one or moregeographic locations. For example, data storage devices 116, 118, and120 may be part of a public cloud infrastructure or a private cloudinfrastructure, or any other manner of distributed storage system. Datastorage devices 116, 118, and 120 may include hard disk drives (HDDs),solid state drives (SSDs), storage clusters, or any other data storagetechnology. Additionally, the storage platform 114 may include adistributed file system (such as Hadoop Distributed File Systems(HDFS)), object storage systems, and the like.

In some embodiments, the communication links between database servicemanager 102 and users 104-108, mutable storage 110 for information aboutmetadata files (i.e., metadata file metadata), and execution platform112 are implemented via one or more data communication networks and maybe assigned various tasks such that user requests can be optimized.Similarly, the communication links between execution platform 112 anddata storage devices 116-120 in storage platform 114 are implemented viaone or more data communication networks. These data communicationnetworks may utilize any communication protocol and any type ofcommunication medium. In some embodiments, the data communicationnetworks are a combination of two or more data communication networks(or sub-networks) coupled to one another. In alternate embodiments,these communication links are implemented using any type ofcommunication medium and any communication protocol.

The database service manager 102, mutable storage 110, executionplatform 112, and storage platform 114 are shown in FIG. 1 as individualcomponents. However, each of database service manager 102, mutablestorage 110, execution platform 112, and storage platform 114 may beimplemented as a distributed system (e.g., distributed across multiplesystems/platforms at multiple geographic locations) or may be combinedinto one or more systems. Additionally, each of the database servicemanager 102, mutable storage 110, the execution platform 112, and thestorage platform 114 may be scaled up or down (independently of oneanother) depending on changes to the requests received from users104-108 and the changing needs of the data processing platform 100.Thus, in the described embodiments, the data processing platform 100 isdynamic and supports regular changes to meet the current data processingneeds.

In an embodiment of the disclosure, a local component, such as theexecution platform 112 that may be distributed across a plurality ofservers, handles data skew during a join operation. In such anembodiment, partitioning of data for handling data skew is notimplemented or computed by the database service manager 102 but isinstead computed on one or more servers such as the execution platform112. In an embodiment of the disclosure, the determination of data skewand of frequent probe-side join keys is made locally on an executionplatform 112 where a join operation is performed. In such an embodiment,the execution platform 112 may asynchronously distribute the frequentprobe-side join keys to one or more other remote servers that mayinclude one or more remote execution platforms 112.

FIG. 2 illustrates a block diagram depicting components of databaseservice manager 102, according to one embodiment. The database servicemanager 102 includes an access manager 202 and a key manager 204 coupledto a data storage device 206. The access manager 202 handlesauthentication and authorization tasks for the systems described herein.The key manager 204 manages storage and authentication of keys usedduring authentication and authorization tasks. A request processingservice 208 manages received data storage requests and data retrievalrequests. A management console service 210 supports access to varioussystems and processes by administrators and other system managers.

The database service manager 102 also includes an SQL compiler 212, anSQL optimizer 214 and an SQL executor 216. SQL compiler 212 parses SQLqueries and generates the execution code for the queries. SQL optimizer214 determines the best method to execute queries based on the data thatneeds to be processed. SQL executor 216 executes the query code forqueries received by database service manager 102. For example, the SQLoptimizer may prune out rows or partitions of a table that do not needto be processed in the query because it is known, based on metadata,that they do not satisfy a predicate of the query. A query scheduler andcoordinator 218 sends received queries to the appropriate services orsystems for compilation, optimization, and dispatch to an executionplatform 212. A virtual warehouse manager 220 manages the operation ofmultiple virtual warehouses.

Additionally, the database service manager 102 includes a configurationand metadata manager 222, which manages the information related to thedata stored in the remote data storage devices and in the local caches.A monitor and workload analyzer 224 oversees the processes performed bythe database service manager 102 and manages the distribution of tasks(e.g., workload) across the virtual warehouses and execution nodes inthe execution platform 112. Configuration and metadata manager 222 andmonitor and workload analyzer 224 are coupled to a data storage device226.

The database service manager 102 also includes a transaction managementand access control module 228, which manages the various tasks and otheractivities associated with the processing of data storage requests anddata access requests. For example, the transaction management and accesscontrol module 228 provides consistent and synchronized access to databy multiple users or systems. Since multiple users/systems may accessthe same data simultaneously, changes to the data may be synchronized toensure that each user/system is working with the current version of thedata. Transaction management and access control module 228 providescontrol of various data processing activities at a single, centralizedlocation in database service manager 102.

The database service manager 102 includes a cluster maintenance module230 that manages the clustering and ordering of partitions of a table.The cluster maintenance module 230 may partition each table in adatabase into one or more partitions or micro-partitions. The clustermaintenance module 230 may not require or achieve ideal clustering forthe table data but may maintain “good enough” or approximate clustering.For example, ideal clustering on a specific attribute may result in eachpartition either having non-overlapping value ranges or having only asingle value for the specific attribute. Because the cluster maintenancemodule 230 does not require perfect clustering, significant processingand memory resources may be conserved during data loading or DML commandoperations.

At least some embodiments may manage the ordering or clustering of atable using micro-partitions. As mentioned previously, traditional datawarehouses rely on static partitioning of large tables to achieveacceptable performance and enable better scaling. In these systems, apartition is a unit of management that is manipulated independentlyusing specialized data definition language (DDL) and syntax. However,static partitioning has a number of well-known limitations, such asmaintenance overhead and data skew, which can result indisproportionately-sized partitions. Embodiments disclosed herein mayimplement a powerful and unique form of partitioning, calledmicro-partitioning, that delivers all the advantages of staticpartitioning without the known limitations, as well as providingadditional significant benefits.

In one embodiment, all data in tables is automatically divided intomicro-partitions, which are contiguous units of storage. By way ofexample, each micro-partition may contain between 50 MB and 500 MB ofuncompressed data (note that the actual size in storage may be smallerbecause data may be stored compressed). Groups of rows in tables aremapped into individual micro-partitions, organized in a columnarfashion. This size and structure allows for extremely granular pruningof very large tables, which can be comprised of millions, or evenhundreds of millions, of micro-partitions. Metadata may be automaticallygathered about all rows stored in a micro-partition, including: therange of values for each of the columns in the micro-partition; thenumber of distinct values, and/or additional properties used for bothoptimization and efficient query processing. In one embodiment,micro-partitioning may be automatically performed on all tables. Forexample, tables may be transparently partitioned using the ordering thatoccurs when the data is inserted/loaded.

FIG. 3 illustrates an example join operation 300. The join operation 300results in result table 320 are constructed based on a join operation tothe build side table 302 and the probe side table 310. The build sidetable 302 is smaller than the probe side table 310 as illustrated inFIG. 3. The build side table includes two attributes (columns) includingbKey 304 and bVal 306. The probe side table 310 further includes twoattributes pKey 312 and pVal 314. The result table 320 indicates theresult of the join operation 300 wherein bKey 304 is equal to pKey 312.The join operation 300 pairs up every row from the build side table 302with every row from the probe side table 310 and then eliminates thoserows where the attribute bKey 304 does not match the attribute pKey 312.In a hash join, the smaller table (in this case, the build side table302) will be called the “build side” and the larger table (in this case,the probe side table 310) will be called the “probe side.” Applicantfurther notes that the order in which rows are depicted in any of thetables is not relevant. It should be appreciated that the systems andmethods of the disclosure may be implemented where the build side tableis not the smaller table and is instead the larger table. Such animplementation would not impact the ability to leverage the skewhandling techniques as disclosed herein.

As an example as illustrated in FIG. 3, there is a bKey 304 value equalto “42” that is associated with the bVal 306 value “X.” Additionallythere is a pKey 312 value “42” that is associated with the pVal 314value “d.” As illustrated in the result table 320 where bKey is equal topKey, the bKey 304 value of “42” is matched with the pKey 312 value of“42,” returning bVal 306 and pVal 314 values of “X” and “d,”respectively.

As illustrated in FIG. 3, where there is a build-side key value (bKey304) in the build side table 302 that is not represented as a probe-sidekey value (pKey 312) in the probe side table 310, any rows includingthat value do not appear in the result table 320. Similarly, where thereis a probe-side key value (pKey 312) in the probe side table 310 that isnot represented as a build-side key value (bKey 304) in the build sidetable 302, any row including that value is not included in the resulttable 320. An example of such a row in the build side table 302 is[512,W] because the “512” key is not represented in the probe side table310. Examples of such rows in the probe side table 310 include [2,a] and[2003,f] because the “2” key and the “2003” key are not represented inthe build side table 302.

FIGS. 4-7 illustrate data tables representing steps associated with abroadcast join operation. FIG. 4 illustrates an example set of tablesfor a join in a parallel database system, wherein FIG. 4 illustrates thetables before broadcast 400. In a parallel database system with multipleservers, data may be structured as illustrated in FIG. 4 before the joinoperation. It should be appreciated that any number of servers may beinvolved in a broadcast join operation, and the figures hereinillustrate two servers for simplicity in illustrating the joinoperation.

Each server, including server one 401 and server two 421 include a buildtable and a probe table. Server one 401 includes a build table B.1 402and a probe table P.1 410. Server two 421 includes a build table B.2 420and a probe table P.2 430. The build table B.1 402 includes bKey 404values and bVal 406 values, and the probe table P.1 410 includes pKey412 values and pVal 414 values. The build table B.2 420 includes bKey422 values and bVal 424 values, and the probe table P.2 430 includespKey 432 values and pVal 434 values. An issue as illustrated in FIG. 4is that server one 401 includes some rows (see e.g. [42,X]) that need tobe joined with one or multiple rows of a probe table that reside on adifferent server (see e.g. [42,d] located on server two 421). To performthe join, the tables need to be repartitioned or redistributed in a waythat allows an efficient computation of the join operation. Depending onthe size of the build table (typically the smaller table), this is donevia a broadcast join or a hash-hash join.

In an embodiment, FIG. 4 illustrates a broadcast join with theassumption that the combination of build table B.1 402 and build tableB.2 420 is small enough to fit into memory of a single server. The buildside is broadcasted to ensure that every server has all the rows of eachof build table B.1 402 and build table B.2 420. Afterward, each servercan probe the subset of a probe table (see probe table P.1 410 or probetable P.2 430) that it owns into the hash table to find matches.

FIG. 5 illustrates the same overall table values as illustrated in FIG.4, but after broadcast of the build side 500 of the join operation. Asillustrated in FIG. 5, after broadcast of the build side 500, eachserver (see server one 401 and server two 421) includes a complete copyof the broadcasted build table 502. The broadcasted build table 502includes all values of the build side of the join operation, includingvalues stored in build table B.1 402 and build table B.2 420. The probeside of the join operation (see probe table P.1 410 and probe table P.2430 is not altered by the broadcasting of the build side 500 to eachserver.

FIG. 6 illustrates the same overall table values as illustrated in FIGS.4-5, but after probing the probe side 600 of the join operation suchthat the final result of the join operation is illustrated. Server one401 has generated a result R.1 602. Server two 421 has generated aresult R.2 620. The union of result R. 1 602 and result R.2 620 providesthe final result. Each server (see server one 401 and server two 421)probes its subset of the probe side table (see probe table P.1 410 andprobe table P.2 430) into the broadcasted build table 502. It should beappreciated that the broadcasted build table 502 may alternatively bereferred to as the hash table. Thus, each server computes a part of theresult and the combined results of all servers yields the correctoverall result of the join.

FIG. 7 illustrates the final result 700 of the broadcast join operationcomputed based on the table values illustrated in FIGS. 4-6. The finalresult 700 includes bKey and bVal values originally found in the buildside of the join operation. The final result 700 further includes pKeyand pVal values originally found in the probe side of the joinoperation. The final result 700 is the union of result R. 1 602 andresult R.2 620 that were determined after probing the probe side of thejoin.

FIGS. 8-10 illustrate data tables representing various steps of ahash-hash join operation. Applicant notes that FIGS. 8-10 include thesame overall table values as illustrated in FIGS. 4-7 for simplicity inillustrating differences between a broadcast join and a hash-hash join.A hash-hash join is commonly implemented where the totality of buildside comprises too much data to fit into a main memory of a singleserver. Both the build side data and the probe side data arehash-partitioned or redistributed to break up the total work into equalparts. For simplicity, FIGS. 8-10 illustrate a simple hash-partitioningfunction that will send each row where the join key is an even number toserver one 801 and send each row where the join key is an odd number toserver two 821. During a build phase of the join, each server willhash-partition every row of the build side (see build table B.1 802 andbuild table B.2 820). The probe side is then redistributed according tothe same hash function. Each server can thus compute its part of theresult locally.

FIG. 8 illustrates data tables on server one 801 and server two 821before hash partitioning 800. Thus, FIG. 8 may represent the originaldata stored on one or more remote servers before a join operation iscommenced. It should be appreciated that any number of servers may beinvolved in a hash-hash join, and the figures herein illustrate twoservers for simplicity. Server one 801 includes a build table B.1 802having bKey 804 values and bVal 806 values. Server one 801 furtherincludes a probe table P.1 810 having pKey 812 and pVal 814 values.Server two 821 includes a build table B.2 820 having bKey 822 values andbVal 824 values. Server two 821 further includes a probe table P.2 830having pKey 832 values and pVal 834 values.

The key values (see bKey 804, pKey 812, bKey 822, and pKey 832)constitute join keys. The join keys indicate how a match may be madebetween data stored in a build side of the join and data stored in aprobe side of the join. That is, the final result of the join operationmandates that the bKey values match the pKey values. Where a build-sidejoin key corresponds with, i.e. matches, a probe-side join key, thebuild-side row and the probe-side row may be joined.

FIG. 9 illustrates the same overall table values as in FIG. 8 after hashpartitioning of the build side 900. FIG. 9 illustrates the result of thebuild phase of the join operation. During the build phase of the joinoperation, each server hash-partitions each row of the build side (seebuild table B.1 802 and build table B.2 820) to generate new partitionedbuild tables (see partitioned build table B.1 902 and partitioned buildtable B.2 920). The probe side tables remain the same (see probe tableP.1 810 and probe table P.2 830). Server one 801 includes partitionedbuild table B.1 902 and probe table P.1 810. Server two 821 includespartitioned build table B.2 920 and probe table P.2 830.

For simplicity, a simple hash-partitioning function is used in anembodiment as illustrated in FIG. 9 such that each build-side row havingan even-numbered join key (see bKey 804 and bKey 822) is sent to serverone 801 and each build-side row having an odd-numbered join key (seebKey 804 and bKey 822) is sent to server two 821. During the build phaseof the join operation, each server will hash-partition every row of thebuild side. For example, server one 801 will keep row [42,X] of buildtable B.1 802 because the join key (42) is an even number. Server one801 will send row [11,Y] to server two 821 because the join key (11) isan odd number. Server two 821 will send row [512,Z] to server one 801because the join key (512) is an even number. Server two will keep rows[7,Q] and [123,Z] because the join keys (7 and 123) are odd numbers.

FIG. 10 illustrates the same overall table values as in FIGS. 8-9 afterhash partitioning of the probe side 1000. The probe side (see probetable P.1 810 and probe table P.2 830) is redistributed according to thesame hash function used with respect to the build side as illustrated inFIG. 9. That is, probe-side rows having an even-numbered join key arepartitioned to server one 801 and probe-side rows having an odd-numberedjoin key are partitioned to server two 821. As illustrated in FIG. 10,the partitioned probe table P.1 1010 on server one 801 includes rowshaving an even-numbered join key including [2,a] and [42,d]. Thepartitioned probe table P.2 1030 on server two 821 includes rows havingan odd-numbered join key including [11,b], [11,h], [123,g], [2003,f],[11,e], [11,o], and [11,u]. As such, each server can compute its part ofthe join result locally.

In an embodiment, the results of the partitioned probe data (seepartitioned probe table P.1 1010 and partitioned probe table P.2 1030)are not stored on the respective servers after the probe side data hasbeen partitioned. Rather, the partitioned probe data is streamed througha server such that each probe data row either remains on the currentserver or is transmitted to a remote server. Either way, the probe datarow is immediately probed into the hash table (i.e. the respectivepartitioned build table) and matched with one or more rows of the buildside. The resulting rows are transmitted to the next operator of thequery execution logic.

FIG. 11 illustrates the partitioned result 1100 after probing thepartitioned probe data (see partitioned probe table P.1 1010 andpartitioned probe table P.2 1030) into the partitioned build data (seepartitioned build table B.1 902 and partitioned build table B.2 920).Server one 801 returns result R. 1 1102 and server two 821 returnsresult R.2 1104. The final result of the hash-hash join operationincludes the union of result R.1 1102 and result R.2 1104. As such, thefinal result of the hash-hash join operation is computed locally by oneor more servers, and the individual results of each of the individualservers is combined to generate the final result.

As illustrated in FIG. 11, the partitioned result 1100 includes a greatdeal of data skew indicating by server two 821 having a great deal moredata than server one 801. The result R.2 1104 includes many more rows ofdata than the result R.1 1102. This is caused by a presence of more rowshaving an odd-numbered join key than rows having an even-numbered joinkey. In an embodiment as illustrated in FIG. 11, server two 821 wouldtake much longer to finish its part of the join operation work.Applicant presents methods, systems, and devices for detectingprobe-side data skew as illustrated in FIG. 11. The methods, systems,and devices as disclosed by applicant are configured to redistribute afrequent build-side row (see e.g. rows having join key “11”) to one ormore remote servers such that all rows having the frequent key (in thiscase “11”) may be probed on any of the one or more remote servers.

FIG. 12 illustrates a process flow 1200 of a system and method fordetecting and managing probe-side skew during a join operation,according to one embodiment. The process flow 1200 includes skewdetection at 1202. The skew detection at 1202 includes detectingprobe-side skew at a runtime of a join operation utilizing a lightweightsketch data structure. The skew detection at 1202 further includesidentifying frequent or heavy hitter join keys on the probe side duringa probe phase of the join operation. The process flow 1200 includesheavy hitter redistribution at 1204. Heavy hitter redistribution at 1204includes identifying frequently hit build-side rows having a build-sidejoin key corresponding to the previously identified frequent (i.e. heavyhitter) join keys. The heavy hitter redistribution at 1204 furtherincludes asynchronously distributing the frequently hit build-side rowsto one or more remote servers. The process flow includes remote serversreceiving heavy hitters at 1206. The remote servers receiving heavyhitters at 1206 includes the one or more remote servers asynchronouslyreceiving the frequently hit build-side rows and generating a separatehash table for the frequently hit build-side rows. The process flow 1200includes remote servers changing input links at 1208. The remote serverschanging input links at 1208 includes the one or more remote serverschanging an input link to route frequent probe-side rows no longer to aspecific remote server but to the local instance of the probe to reducenetwork traffic.

It should be appreciated that a heavy hitter includes a frequently seenor frequently used join key or row. In an embodiment, a heavy hitterincludes a build-side row that is frequently hit by the probe side ofthe join operation. In an embodiment, a heavy hitter includes aprobe-side join key that does not find a build-side row. In anembodiment, a heavy hitter includes a probe-side join key that isfrequently probed by the build side.

The process flow 1200 can enable a local computing device, such as aserver or an execution platform 112, to outsource one or more frequentbuild-side rows to one or more other servers. The one or more otherservers may be referred to as “remote” servers and this may denote thatthe one or more other servers is simply different from the local serverthat is conducting the join operation. A remote server need not bephysically remote and may be located in the same geographical region asthe local server. In an embodiment of the disclosure, a plurality ofcomputing devices or servers are in communication with one another andthe plurality of computing devices or servers share the computing loadof processing a join operation. In such an embodiment, a local serverasynchronously distributes frequently hit build-side rows to one or moreremote servers, and the one or more remote servers are configured toasynchronously receive the frequently hit build-side rows and generate aseparate hash table for the frequently hit build-side rows. In anembodiment of the disclosure the plurality of computing devices orservers and configured to efficiently process a join operation such thatfrequently hit build-side rows are distributed amongst the plurality ofcomputing devices or servers.

FIG. 13 illustrates a process flow 1300 of a process for skew detection(see e.g. 1202 at FIG. 12), according to one embodiment. The processflow 1300 includes computing a hash table for a join operation at 1302and selecting a rowset comprising a plurality of rows of the joinoperation at 1304. The process flow 1300 includes utilizing the hashtable computed for the join operation and probing each row of the rowsetinto a space saving algorithm at 1306. The process flow 1300 includesupdating the space saving algorithm based on incoming data, wherein theincoming data includes probe side rowsets at 1308. The process flow 1300includes identifying a frequent probe-side join key on a probe side ofthe join operating during a probe phase of the join operation at 1310.The process flow 1300 includes, for each update to the space savingalgorithm, identifying how frequently the frequent probe-side join keyis probed as a side-effect of updating the space saving algorithm at1312. The process flow 1300 includes the determination of whether thefrequency of the frequent probe-side join keys exceeds a predeterminedthreshold at 1314. If the determination at 1314 is yes, then the processflow 1300 includes sending rows associated with the frequent probe-sidejoin key to a remote server at 1316. If the determination at 1314 is no,then the process flow 1300 includes retaining the rows associated withthe frequent probe-side join key on the current server at 1318.

FIG. 14 illustrates a process flow 1400 of a process for heavy hitterredistribution (see e.g. 1204 at FIG. 12). The process flow 1400includes recording a total number of rows inserted into the space savingalgorithm at 1402. The process flow 1400 includes calculating athreshold per worker based on the total number of rows inserted into thespace saving algorithm at 1404 and ensuring that frequent join keys arefrequent among all threads of at least one server at 1406. The processflow 1400 includes determining heavy hitters comprising one or more offrequent build-side rows that are frequently hit by the probe side andfrequent probe-side keys that do not find a build side row at 1408. Theprocess flow 1400 includes the determination of whether the heavyhitters should be broadcast to all remote servers at 1410. This may bedetermined by a client request, a threshold metric to be satisfied, andso forth. If the determination at 1410 is yes, then the process flow1400 includes broadcasting heavy hitters to every remote server at 1412.If the determination at 1410 is no, then the process flow 1400 includesbroadcasting heavy hitters to only those remote servers that frequentlysent the heavy hitter key at 1414.

The space saving algorithm includes, for example, the space savingalgorithm and space saving sketch as disclosed in: Metwally, Ahmed,Divyakant Agrawal, and Amr El Abbadi. Efficient Computation of Frequentand Top-k Elements in Data Streams. Department of Computer ScienceUniversity of California, Santa Barbara, which is disclosed herein byreference in its entirety. The space saving algorithm provides anintegrated approach for solving problems of finding frequent elements ina data stream such as a join operation. The space saving algorithmprovides an associated stream summary data structure. The underlyingconcept of the space saving algorithm is to maintain partial informationof interest, i.e. only certain elements are monitored. Counters areupdated in a way that accurately estimates frequencies of significantelements, and a lightweight sketch data structure is utilized that keepsthe elements sorted by their estimated frequencies.

The space saving algorithm includes observing an element that ismonitored and incrementing the element's counter. If an element is notmonitored, the element is given the least estimated hits and the counteris calculated as the last estimated hits plus one. For each monitoredelement, the space saving algorithm keeps track of its over-estimationresulting from the initialization of its counter when it was insertedinto the list. The space saving algorithm makes use of the skewedproperty of the data in that the space saving algorithm expects aminority of the elements, i.e. the more frequent elements, to receivethe majority of hits. Frequent elements will reside in the counters ofbigger values and will not be distorted by the ineffective hits of theinfrequent elements, and thus, will not be replaced out of the monitoredcounters. The infrequent elements will reside on smaller counters, whosevalues will grow slower than those of the larger counters. If skewremains but the popular elements change overtime, the space savingalgorithm will adapt automatically. The elements that are growing morepopular will gradually be pushed to the top of the list as they receivemore hits. If one of the previously popular elements loses itspopularity, it will receive less hits. Thus, the relative position ofthe previously popular element will decline as other counters areincremented, and the previously popular element might eventually bedropped from the list.

In the space saving algorithm, even if the data is not skewed, theerrors in the counters will be inversely proportional to the number ofcounters. Maintaining only a moderate number of counters will reduceerror because the more counters that are maintained, the less it isprobable to replace elements, and the smaller the over-estimation errorsin a counter's values. In an embodiment the space saving algorithm isimplemented in a data structure that increments counters withoutviolating the order of the counters and ensures constant time retrieval.

FIG. 15 illustrates a schematic block diagram of a process flow 1500 forquery processing. The process flow 1500 depicts an execution plancomprising multiple operators or building blocks. The process flow 1500computes a hash join between a build-side table and a probe-side tableand then filters out some of the resulting rows and performs anaggregation over all of the build-side keys and the probe-side keys as aresult of the join operation.

The process flow 1500 includes scanning a build table by reading thebuild table from a disk at 1502 and partitioning the build table at1504. The process flow 1500 includes scanning a probe table by readingthe probe table from a disk at 1506. The process flow 1500 includesjoining the build table with the probe table at 1508. The process flow1500 includes filtering rows where a build-side value is not equal to aset key at 1510. The process flow 1500 includes aggregating the sum ofall build-side keys and probe-side keys at 1512. The process flow 1500includes providing the result at 1514.

FIG. 16 illustrates a schematic flow chart diagram of a method 1600 formanaging probe-side skew during a join operation of a database. Themethod 1600 begins and a server computes a hash value for a joinoperation at 1602. The server detects data skew on a probe side of thejoin operation at a runtime of the join operation using a lightweightsketch data structure at 1604. The server identifies a frequentprobe-side join key on the probe side of the join operation during aprobe phase of the join operation at 1606. The server identifies afrequent build-side row having a build-side join key corresponding withthe frequent probe-side join key at 1608. The server asynchronouslydistributes the frequent build-side row to one or more remote servers at1610. It should be appreciated that the server may include any suitablecomputing platform, including the execution platform 112 discussed inFIG. 1.

FIG. 17 illustrates a schematic flow chart diagram of a method 1700 forhandling probe-side skew during a join operation of a database. Themethod 1700 begins and a server computes a hash value for a joinoperation at 1702 wherein the hash value may comprise a hash table. Theserver selects a rowset comprising a plurality of rows of the joinoperation and probes each of the plurality of rows of the rowset into aspace saving algorithm using the hash value for the join operation at1704. The server updates the space saving algorithm based on incomingdata at 1706. The server, for each update to the space saving algorithm,identifies a frequency indicating how frequently a frequent probe-sidejoin key is probed as a side effect of the updating the space savingalgorithm at 1708. The server determines if the frequency exceeds apredetermined threshold at 1710. The server identifies a frequentbuild-side row having a build-side join key corresponding with thefrequent probe-side join key at 1712. The server, in response to thefrequency exceeding the predetermined threshold, asynchronouslydistributes the frequent build-side row to the one or more remoteservers at 1714. It should be appreciated that the server may includeany suitable computing platform, including the execution platform 112discussed in FIG. 1.

In an embodiment of the disclosure, systems, methods, and devices fordetecting and managing data skew during a join operation are disclosed.As illustrated in FIGS. 8-11, a hash-hash join includes two phases. Thehash-hash join includes a build phase wherein the hash tables aregenerated (the hash tables include build-side data). The hash-hash joinincludes a probe phase wherein probe-side data is probed into the hashtable to find matching build-side rows for the probe-side rows based onthe respective join keys.

In an embodiment, skew detection is conducted in a vectorized waywherein batches of rows are processed together. In an embodiment, abatch includes, for example, hundreds or thousands of rows that are beprocess together as a single rowset. In an embodiment a probe rowset isselected for detection of data skew. In an embodiment, a first rowset isnot selected and then approximately every n^(th) rowset is selected fordetection of data skew. In an embodiment, the hash value computed forthe join operation is reused to probe each row of the rowset into aspace saving algorithm and data structure.

The space saving algorithm and data structure approximately maintainsthe N most frequent probe-side join keys. Due to the probabilisticnature of the space saving algorithm, the result might not be entirelyaccurate and may return a small error that increases in accuracy as thedistribution of data becomes more skewed. In an embodiment, the spacesaving algorithm is not updated with every rowset. In an embodiment, thespace saving algorithm is updated with a subset of incoming data, forexample a small hash table of size N. In an embodiment, the hash valuethat was computed for the join operation is reused and is updated withthe same subset of incoming data. In an embodiment after the spacesaving algorithm has been updated one or more times, the systems,methods, and devices of the disclosure will begin to identify frequentjoin keys as a side-effect of updating the space saving algorithm. In anembodiment, for each update, the frequency of the frequent join key isdetected and if the number exceeds a threshold, the associatedbuild-side row having the frequent join key is sent to one or moreremote servers.

In an embodiment, for all workers threads of a server, the total numberof rows inserted into the space saving algorithm is recorded. Based onthe number of rows inserted into the space saving algorithm, a thresholdper worker thread is computed that ensures that keys are frequent amongall threads of at least one server if the row is classified as a“frequent” or heavy hitter. In an embodiment, rows comprising a frequentjoin key are redistributed to one or more remote servers. It should beappreciated that a “frequent” key or row (also referred to as a heavyhitter) may include either of a build-side row that is frequently hit bythe probe side or a probe-side key that does not find a build-side rowand is probed anyway because a bloom filter fails to remove it from thejoin operation. In an embodiment, rows comprising a frequent join keyare broadcasted to every other remote server. In an embodiment, the rowscomprising a frequent join key are broken down and distributed perserver that sent the frequent join key. In an embodiment, if only asubset of remote servers frequently sends the join key, the rowscomprising the frequent join key may be distributed only to that subsetof remote servers.

In an embodiment, a link change is made. In an embodiment a link is asoftware component configured to connect two operators and send a rowsetfrom a source operator to a destination operator. The source operatorand the destination operator may be on the same server or on differentservers. A link governs which row is sent to which instance of the nextoperator. A local link invokes the destination operator on the sameserver with the rowset. A broadcast link transmits each row in therowset to every instance of the destination operator. A hash linkcomputes a hash value of some of the attributes of the rowset anddistributes the rows according to that hash value. In an embodiment forprobe-side skew handling, a hash link also checks a small separate hashtable that contains exceptions. If the hash link finds an exception fora hash value, it does not send the row to the instance associated withthat hash value but instead to its local counterpart (i.e. thedestination operator's instance on the same server). In an embodiment,changing a link includes adding an entry into the small hash table inthe link.

In an embodiment of the disclosure, a system for managing data skew isdisclosed. The system includes a means for computing a hash value for ajoin operation. The system includes a means for detecting data skew on aprobe side of the join operation at a runtime of the join operationusing a lightweight sketch data structure. The system includes a meansfor identifying a frequent probe-side join key on the probe side of thejoin operation during a probe phase of the join operation. The systemincludes a means for identifying a frequent build-side row having abuild-side join key corresponding with the frequent probe-side join key.The system includes a means for asynchronously distributing the frequentbuild-side row to one or more remote servers.

It will be appreciated that the structures, materials, or acts disclosedherein are merely one example of, for example, a means for computing ahash value for a join operation, and it should be appreciated that anystructure, material, or act for computing a hash value for a joinoperation which performs functions the same as, or equivalent to, thosedisclosed herein are intended to fall within the scope of a means forcomputing a hash value for a join operation, including those structures,materials, or acts for computing a hash value for a join operation whichare presently known, or which may become available in the future.Anything which functions the same as, or equivalently to, a means forcomputing a hash value for a join operation falls within the scope ofthis element.

It will be appreciated that the structures, materials, or acts disclosedherein are merely one example of, for example, a means for detectingdata skew on a probe side of the join operation at a runtime of the joinoperation using a lightweight sketch data structure, and it should beappreciated that any structure, material, or act for detecting data skewon a probe side of the join operation at a runtime of the join operationusing a lightweight sketch data structure which performs functions thesame as, or equivalent to, those disclosed herein are intended to fallwithin the scope of a means for detecting data skew on a probe side ofthe join operation at a runtime of the join operation using alightweight sketch data structure, including those structures,materials, or acts for detecting data skew on a probe side of the joinoperation at a runtime of the join operation using a lightweight sketchdata structure which are presently known, or which may become availablein the future. Anything which functions the same as, or equivalently tomeans for detecting data skew on a probe side of the join operation at aruntime of the join operation using a lightweight sketch data structurefalls within the scope of this element.

It will be appreciated that the structures, materials, or acts disclosedherein are merely one example of, for example, means for identifying afrequent probe-side join key on the probe side of the join operationduring a probe phase of the join operation, and it should be appreciatedthat any structure, material, or act for identifying a frequentprobe-side join key on the probe side of the join operation during aprobe phase of the join operation which performs functions the same as,or equivalent to, those disclosed herein are intended to fall within thescope of a means for identifying a frequent probe-side join key on theprobe side of the join operation during a probe phase of the joinoperation, including those structures, materials, or acts for detectingdata skew on a probe side of the join operation at a runtime of the joinoperation using a lightweight sketch data structure which are presentlyknown, or which may become available in the future. Anything whichfunctions the same as, or equivalently to means for identifying afrequent probe-side join key on the probe side of the join operationduring a probe phase of the join operation falls within the scope ofthis element.

FIG. 18 is a block diagram depicting an example computing device 1800.In some embodiments, computing device 1800 is used to implement one ormore of the systems and components discussed herein. For example, thecomputing device 1800 may be used to implement one or more of thedatabase service manager 102, components or modules configured todetecting and managing data skew during a join operation, and one ormeans for carrying out process steps for detecting and managing dataskew during a join operation. Further, computing device 1800 mayinteract with any of the systems and components described herein.Accordingly, computing device 1800 may be used to perform variousprocedures and tasks, such as those discussed herein. Computing device1800 can function as a server, a client or any other computing entity.Computing device 1800 can be any of a wide variety of computing devices,such as a desktop computer, a notebook computer, a server computer, ahandheld computer, a tablet, and the like.

Computing device 1800 includes one or more processor(s) 1802, one ormore memory device(s) 1804, one or more interface(s) 1806, one or moremass storage device(s) 1808, and one or more Input/Output (I/O)device(s) 1810, all of which are coupled to a bus 1812. Processor(s)1802 include one or more processors or controllers that executeinstructions stored in memory device(s) 1804 and/or mass storagedevice(s) 1808. Processor(s) 1802 may also include various types ofcomputer-readable media, such as cache memory.

Memory device(s) 1804 include various computer-readable media, such asvolatile memory (e.g., random access memory (RAM)) and/or nonvolatilememory (e.g., read-only memory (ROM)). Memory device(s) 1804 may alsoinclude rewritable ROM, such as Flash memory.

Mass storage device(s) 1808 include various computer readable media,such as magnetic tapes, magnetic disks, optical disks, solid statememory (e.g., Flash memory), and so forth. Various drives may also beincluded in mass storage device(s) 1808 to enable reading from and/orwriting to the various computer readable media. Mass storage device(s)1808 include removable media and/or non-removable media.

I/O device(s) 1810 include various devices that allow data and/or otherinformation to be input to or retrieved from computing device 1800.Example I/O device(s) 1810 include cursor control devices, keyboards,keypads, microphones, monitors or other display devices, speakers,printers, network interface cards, modems, lenses, CCDs or other imagecapture devices, and the like.

Interface(s) 1806 include various interfaces that allow computing device1800 to interact with other systems, devices, or computing environments.Example interface(s) 1806 include any number of different networkinterfaces, such as interfaces to local area networks (LANs), wide areanetworks (WANs), wireless networks, and the Internet.

Bus 1812 allows processor(s) 1802, memory device(s) 1804, interface(s)1806, mass storage device(s) 1808, and I/O device(s) 1810 to communicatewith one another, as well as other devices or components coupled to bus1812. Bus 1812 represents one or more of several types of busstructures, such as a system bus, PCI bus, IEEE 1394 bus, USB bus, andso forth.

For purposes of illustration, programs and other executable programcomponents are shown herein as discrete blocks, although it isunderstood that such programs and components may reside at various timesin different storage components of computing device 1800 and areexecuted by processor(s) 1802. Alternatively, the systems and proceduresdescribed herein can be implemented in hardware, or a combination ofhardware, software, and/or firmware. For example, one or moreapplication specific integrated circuits (ASICs) can be programmed tocarry out one or more of the systems and procedures described herein. Asused herein, the terms “module” or “component” are intended to conveythe implementation apparatus for accomplishing a process, such as byhardware, or a combination of hardware, software, and/or firmware, forthe purposes of performing all or parts of operations disclosed herein.The terms “module” or “component” are intended to convey independent inhow the modules, components, or their functionality or hardware may beimplemented in different embodiments.

EXAMPLES

The following examples pertain to further embodiments.

Example 1 is a method for managing data skew. The method includes:computing a hash value for a join operation; detecting data skew on aprobe side of the join operation at a runtime of the join operationusing a lightweight sketch data structure; identifying a frequentprobe-side join key on the probe side of the join operation during aprobe phase of the join operation; identifying a frequent build-side rowhaving a build-side join key corresponding with the frequent probe-sidejoin key; and asynchronously distributing the frequent build-side row toone or more remote servers.

Example 2 is a method as in Example 1, wherein the one or more remoteservers is configured to: asynchronously receive the frequent build-siderow; and generate a separate hash table for the frequent build-side row.

Example 3 is a method as in any of Examples 1-2, further including:selecting a rowset comprising a plurality of rows of the join operation;and probing each of the plurality of rows of the rowset into a spacesaving algorithm using the hash value for the join operation.

Example 4 is a method as in any of Examples 1-3, updating the spacesaving algorithm based on incoming data; and for each update to thespace saving algorithm, identifying a frequency indicating howfrequently the frequent probe-side join key is probed as a side-effectof the updating the space saving algorithm.

Example 5 is a method as in any of Examples 1-4, wherein asynchronouslydistributing the frequent build-side row to the one or more remoteservers comprises: in response to the frequency exceeding apredetermined threshold, asynchronously distributing the frequentbuild-side row to the one or more remote servers; and in response to thefrequency not exceeding the predetermined threshold, retaining thefrequent build-side row on a current server.

Example 6 is a method as in any of Examples 1-5, further including:calculating a total number of rows of the join operation that have beenprobed into the space saving algorithm; calculating a threshold perworker thread based on the total number of rows of the join operationthat have been probed into the space saving algorithm; and based on thethreshold per worker thread, determining whether the frequent build-sidejoin key is frequent among all threads of at least one server.

Example 7 is a method as in any of Examples 1-6, wherein asynchronouslydistributing the frequent build-side row to the one or more remoteservers comprises one of: broadcasting the frequent build-side row toeach of a plurality of available remote servers; or broadcasting thefrequent build-side row only to one or more remote servers thatfrequently transmitted the frequent build-side join key.

Example 8 is a method as in any of Examples 1-7, further comprisingaltering an input link of a server to route a frequent probe-side rowcomprising the frequent probe-side join key to a local instance of thejoin operation such that network traffic is reduced.

Example 9 is a method as in any of Examples 1-8, wherein asynchronouslydistributing the frequent build-side row to the one or more remoteservers occurs only after determining, to a threshold confidence level,that the frequent probe-side join key is frequent on a server.

Example 10 is a method as in any of Examples 1-9, wherein thelightweight sketch data structure comprises a hash table space savingalgorithm.

Example 11 is non-transitory computer readable storage media storinginstructions that, when executed by one or more processors, cause theone or more processors to: compute a hash value for a join operation;detect data skew on a probe side of the join operation at a runtime ofthe join operation using a lightweight sketch data structure; identify afrequent probe-side join key on the probe side of the join operationduring a probe phase of the join operation; identify a frequentbuild-side row having a build-side join key corresponding with thefrequent probe-side join key; and asynchronously distribute the frequentbuild-side row to one or more remote servers.

Example 12 is non-transitory computer readable storage media as inExample 11, wherein the instructions further cause the one or moreprocessors to: select a rowset comprising a plurality of rows of thejoin operation; and probe each of the plurality of rows of the rowsetinto a space saving algorithm using the hash value for the joinoperation.

Example 13 is non-transitory computer readable storage media as in anyof Examples 11-12, wherein the instructions further cause the one ormore processors to: update the space saving algorithm based on incomingdata; and for each update to the space saving algorithm, identify afrequency indicating how frequently the frequent probe-side join key isprobed as a side-effect of the one or more processors updating the spacesaving algorithm.

Example 14 is non-transitory computer readable storage media as in anyof Examples 11-13, wherein causing the one or more processors toasynchronously distribute the frequent build-side row to the one or moreremote servers comprises: in response to the frequency exceeding apredetermined threshold, asynchronously distribute the frequentbuild-side row to the one or more remote servers; and in response to thefrequency not exceeding the predetermined threshold, retaining thefrequent build-side row on a current server.

Example 15 is non-transitory computer readable storage media as in anyof Examples 11-14, wherein the instructions further cause the one ormore processors to: calculate a total number of rows of the joinoperation that have been probed into the space saving algorithm;calculate a threshold per worker thread based on the total number ofrows of the join operation that have been probed into the space savingalgorithm; and based on the threshold per worker thread, determiningwhether the frequent build-side join key is frequent among all threadsof at least one server.

Example 16 is non-transitory computer readable storage media as in anyof Examples 11-15, wherein causing the one or more processors toasynchronously distribute the frequent build-side row to the one or moreremote servers comprises one of: broadcasting the frequent build-siderow to each of a plurality of available remote servers; or broadcastingthe frequent build-side row only to one or more remote servers thatfrequently transmitted the frequent build-side join key.

Example 17 is non-transitory computer readable storage media as in anyof Examples 11-16, wherein the instructions further cause the one ormore processors to alter an input link of a server to route a frequentprobe-side row comprising the frequent probe-side join key to a localinstance of the join operation such that network traffic is reduced.

Example 18 is a system for managing data skew. The system includes: ameans for computing a hash value for a join operation; a means fordetecting data skew on a probe side of the join operation at a runtimeof the join operation using a lightweight sketch data structure; a meansfor identifying a frequent probe-side join key on the probe side of thejoin operation during a probe phase of the join operation; a means foridentifying a frequent build-side row having a build-side join keycorresponding with the frequent probe-side join key; and a means forasynchronously distributing the frequent build-side row to one or moreremote servers.

Example 19 is a system as in Example 18, further including: a means forselecting a rowset comprising a plurality of rows of the join operation;and a means for probing each of the plurality of rows of the rowset intoa space saving algorithm using the hash value for the join operation.

Example 20 is a system as in any of Examples 18-19, further including: ameans for updating the space saving algorithm based on incoming data;and for each update to the space saving algorithm, a means foridentifying a frequency indicating how frequently the frequentprobe-side join key is probed as a side-effect of the updating the spacesaving algorithm.

Example 21 is a system as in any of Examples 18-20, wherein the meansfor asynchronously distributing the frequent build-side row to the oneor more remote servers is further configured to: in response to thefrequency exceeding a predetermined threshold, asynchronously distributethe frequent build-side row to the one or more remote servers; and inresponse to the frequency not exceeding the predetermined threshold,retaining the frequent build-side row on a current server.

Example 22 is a system as in any of Examples 18-21, further including: ameans for calculating a total number of rows of the join operation thathave been probed into the space saving algorithm; a means forcalculating a threshold per worker thread based on the total number ofrows of the join operation that have been probed into the space savingalgorithm; and a means for determining, based on the threshold perworker thread, whether the frequent build-side join key is frequentamong all threads of at least one server.

Various techniques, or certain aspects or portions thereof, may take theform of program code (i.e., instructions) embodied in tangible media,such as floppy diskettes, CD-ROMs, hard drives, a non-transitorycomputer readable storage medium, or any other machine-readable storagemedium wherein, when the program code is loaded into and executed by amachine, such as a computer, the machine becomes an apparatus forpracticing the various techniques. In the case of program code executionon programmable computers, the computing device may include a processor,a storage medium readable by the processor (including volatile andnon-volatile memory and/or storage elements), at least one input device,and at least one output device. The volatile and non-volatile memoryand/or storage elements may be a RAM, an EPROM, a flash drive, anoptical drive, a magnetic hard drive, or another medium for storingelectronic data. One or more programs that may implement or utilize thevarious techniques described herein may use an application programminginterface (API), reusable controls, and the like. Such programs may beimplemented in a high-level procedural, functional, object-orientedprogramming language to communicate with a computer system. However, theprogram(s) may be implemented in assembly or machine language, ifdesired. In any case, the language may be a compiled or interpretedlanguage, and combined with hardware implementations.

It should be understood that many of the functional units described inthis specification may be implemented as one or more components ormodules, which are terms used to more particularly emphasize theirimplementation independence. For example, a component or module may beimplemented as a hardware circuit comprising custom very large-scaleintegration (VLSI) circuits or gate arrays, off-the-shelf semiconductorssuch as logic chips, transistors, or other discrete components. Acomponent may also be implemented in programmable hardware devices suchas field programmable gate arrays, programmable array logic,programmable logic devices, or the like.

Components may also be implemented in software for execution by varioustypes of processors. An identified component of executable code may, forinstance, comprise one or more physical or logical blocks of computerinstructions, which may, for instance, be organized as an object, aprocedure, or a function. Nevertheless, the executables of an identifiedcomponent need not be physically located together but may comprisedisparate instructions stored in different locations that, when joinedlogically together, comprise the component and achieve the statedpurpose for the component.

Indeed, a component of executable code may be a single instruction, ormany instructions, and may even be distributed over several differentcode segments, among different programs, and across several memorydevices. Similarly, operational data may be identified and illustratedherein within components and may be embodied in any suitable form andorganized within any suitable type of data structure. The operationaldata may be collected as a single data set or may be distributed overdifferent locations including over different storage devices, and mayexist, at least partially, merely as electronic signals on a system ornetwork. The components may be passive or active, including agentsoperable to perform desired functions.

Reference throughout this specification to “an example” means that aparticular feature, structure, or characteristic described in connectionwith the example is included in at least one embodiment of the presentdisclosure. Thus, appearances of the phrase “in an example” in variousplaces throughout this specification are not necessarily all referringto the same embodiment.

As used herein, a plurality of items, structural elements, compositionalelements, and/or materials may be presented in a common list forconvenience. However, these lists should be construed as though eachmember of the list is individually identified as a separate and uniquemember. Thus, no individual member of such list should be construed as ade facto equivalent of any other member of the same list solely based onits presentation in a common group without indications to the contrary.In addition, various embodiments and examples of the present disclosuremay be referred to herein along with alternatives for the variouscomponents thereof. It is understood that such embodiments, examples,and alternatives are not to be construed as de facto equivalents of oneanother but are to be considered as separate and autonomousrepresentations of the present disclosure.

Although the foregoing has been described in some detail for purposes ofclarity, it will be apparent that certain changes and modifications maybe made without departing from the principles thereof. It should benoted that there are many alternative ways of implementing both theprocesses and apparatuses described herein. Accordingly, the presentembodiments are to be considered illustrative and not restrictive.

Those having skill in the art will appreciate that many changes may bemade to the details of the above-described embodiments without departingfrom the underlying principles of the disclosure.

What is claimed is:
 1. A method comprising: detecting, by a local servercomprising at least one hardware processor, data skew on a probe side ofa join operation at a runtime of the join operation; identifying, by thelocal server, a frequent probe-side join key on the probe side of thejoin operation during a probe phase of the join operation; identifying,by the local server, a frequent build-side row, the identified frequentbuild-side row comprising a frequent build-side join key correspondingto the identified frequent probe-side join key; asynchronouslydistributing, by the local server in response to detecting the data skewon the probe side of the join operation, the identified frequentbuild-side row to a plurality of remote servers that frequentlytransmitted the frequent build-side join key, the asynchronouslydistributing facilitating the join operation being processed by acombination of the local server and the plurality of remote serverswithout burdening only a single one of those servers with processing thejoin operation; asynchronously receiving, by each of the plurality ofremote servers that each comprise at least one hardware processor, theidentified frequent build-side row; and generating, by each of theplurality of remote servers, a separate hash table for the identifiedfrequent build-side row as part of processing a portion of the joinoperation.
 2. The method of claim 1, further comprising: identifying, bythe local server, a second frequent probe-side join key on the probeside of the join operation during the probe phase of the join operation;identifying, by the local server, a second frequent build-side row, theidentified second frequent build-side row comprising a second frequentbuild-side join key corresponding to the identified second frequentprobe-side join key; and asynchronously distributing, by the localserver, the identified second frequent build-side row to a secondplurality of remote servers that frequently transmitted the secondfrequent build-side join key.
 3. The method of claim 1, wherein each ofthe plurality of remote servers is configured to route probe-side rowshaving the identified frequent probe-side join key for local processingon the respective remote server as part of processing the joinoperation.
 4. The method of claim 3, wherein each of the plurality ofremote servers being configured to route probe-side rows having theidentified frequent probe-side join key for local processing on therespective remote server as part of processing the join operationcomprises each of the plurality of remote servers being configured toalter an input link to route the probe-side rows having the identifiedfrequent probe-side join key to a local instance of the join operation.5. The method of claim 1, further comprising: computing, by the localserver, a hash value for the join operation; selecting, by the localserver, a rowset comprising a plurality of rows of the join operation;and probing by the local server, each of the plurality of rows of therowset into a space saving algorithm using the hash value for the joinoperation.
 6. The method of claim 5, further comprising: performing, bythe local server, one or more updates to the space saving algorithmbased on incoming data; and identifying, by the local server based onthe performed one or more updates to the space saving algorithm, afrequency indicating how frequently the identified frequent probe-sidejoin key is probed.
 7. The method of claim 6, wherein asynchronouslydistributing the identified frequent build-side row to the plurality ofremote servers is also in response to the identified frequency exceedinga predetermined threshold.
 8. The method of claim 5, further comprising:calculating, by the local server, a total number of rows of the joinoperation that have been probed into the space saving algorithm;calculating, by the local server, a threshold per worker thread based onthe total number of rows of the join operation that have been probedinto the space saving algorithm; and determining, by the local serverbased on the threshold per worker thread, whether the frequentbuild-side join key is frequent among all threads of at least one serveramong the local server and the plurality of remote servers.
 9. Themethod of claim 1, wherein identifying the frequent probe-side join keyon the probe side of the join operation during the probe phase of thejoin operation comprises identifying the frequent probe-side join key asbeing frequent to a threshold confidence level.
 10. The method of claim1, wherein the local server detects the data skew on the probe side ofthe join operation at the runtime of the join operation using alightweight sketch data structure.
 11. A system comprising: a localserver comprising: at least one local-server hardware processor; and oneor more local-server non-transitory computer readable storage mediacontaining local-server instructions that, when executed by the at leastone local-server hardware processor, cause the at least one local-serverhardware processor to perform local-server operations comprising:detecting data skew on a probe side of a join operation at a runtime ofthe join operation; identifying a frequent probe-side join key on theprobe side of the join operation during a probe phase of the joinoperation; identifying a frequent build-side row, the identifiedfrequent build-side row comprising a frequent build-side join keycorresponding to the identified frequent probe-side join key; andasynchronously distributing, in response to detecting the data skew onthe probe side of the join operation, the identified frequent build-siderow to a plurality of remote servers that frequently transmitted thefrequent build-side join key, the asynchronously distributingfacilitating the join operation being processed by a combination of thelocal server and the plurality of remote servers without burdening onlya single one of those servers with processing the join operation; andthe plurality of remote servers each comprising: at least oneremote-server hardware processor; and one or more remote-servernon-transitory computer readable storage media containing remote-serverinstructions that, when executed by the at least one remote-serverhardware processor, cause the at least one remote-server hardwareprocessor to perform remote-server operations comprising: asynchronouslyreceiving the identified frequent build-side row; and generating aseparate hash table for the identified frequent build-side row as partof processing a portion of the join operation.
 12. The system of claim11, the local-server operations further comprising: identifying a secondfrequent probe-side join key on the probe side of the join operationduring the probe phase of the join operation; identifying a secondfrequent build-side row, the identified second frequent build-side rowcomprising a second frequent build-side join key corresponding to theidentified second frequent probe-side join key; and asynchronouslydistributing the identified second frequent build-side row to a secondplurality of remote servers that frequently transmitted the secondfrequent build-side join key.
 13. The system of claim 11, wherein eachof the plurality of remote servers is further configured to routeprobe-side rows having the identified frequent probe-side join key forlocal processing on the respective remote server as part of processingthe join operation.
 14. The system of claim 13, wherein each of theplurality of remote servers being configured to route probe-side rowshaving the identified frequent probe-side join key for local processingon the respective remote server as part of processing the join operationcomprises each of the plurality of remote servers being configured toalter an input link to route the probe-side rows having the identifiedfrequent probe-side join key to a local instance of the join operation.15. The system of claim 11, the local server operations furthercomprising: computing a hash value for the join operation, selecting arow-set comprising a plurality of rows of the join operation; andprobing each of the plurality of rows of the rowset a space savingalgorithm using the hash value for the join operation.
 16. The system ofclaim 15, the local-server operations further comprising: performing oneor more updates to the space saving algorithm based on incoming data;and identifying, based on the performed one or more updates to the spacesaving algorithm, a frequency indicating how frequently the identifiedfrequent probe-side join key is probed.
 17. The system of claim 16,wherein asynchronously distributing the identified frequent build-siderow to the plurality of remote servers is also in response to theidentified frequency exceeding a predetermined threshold.
 18. The systemof claim 15, the local-server operations further comprising: calculatinga total number of rows of the join operation that have been probed intothe space saving algorithm; calculating a threshold per worker threadbased on the total number of rows of the join operation that have beenprobed into the space saving algorithm; and determining, based on thethreshold per worker thread, whether the frequent build-side join key isfrequent among all threads of at least one server among the local serverand the plurality of remote servers.
 19. The system of claim 11, whereinidentifying the frequent probe-side join key on the probe side of thejoin operation during the probe phase of the join operation comprisesidentifying the frequent probe-side join key as being frequent to athreshold confidence level.
 20. The system of claim 11, wherein thelocal server detects the data skew on the probe side of the joinoperation at the runtime of the join operation using a lightweightsketch data structure.
 21. One or more non-transitory computer readablestorage media containing instructions that, when executed by at leastone hardware processor, cause the at least one hardware processor toperform operations comprising: detecting, by a local server, data skewon a probe side of the join operation at a runtime of the joinoperation; identifying, by the local server, a frequent probe-side joinkey on the probe side of the join operation during a probe phase of thejoin operation; identifying, by the local server, a frequent build-siderow, the identified frequent build-side row comprising a frequentbuild-side join key corresponding to the identified frequent probe-sidejoin key; asynchronously distributing, by the local server in responseto detecting the data skew on the probe side of the join operation, theidentified frequent build-side row to a plurality of remote servers thatfrequently transmitted the frequent build-side join key, theasynchronously distributing facilitating the join operation beingprocessed by a combination of the local server and the plurality ofremote servers without burdening only a single one of those servers withprocessing the join operation; asynchronously receiving, by each of theplurality of remote servers, the identified frequent build-side row; andgenerating, by each of the plurality of remote servers, a separate hashtable forthe identified frequent build-side row as part of processing aportion of the join operation.
 22. The non-transitory computer readablestorage media of claim 21, the operations further comprising:identifying, by the local server, a second frequent probe-side join keyon the probe side of the join operation during the probe phase of thejoin operation; identifying, by the local server, a second frequentbuild-side row, the identified second frequent build-side row comprisinga second frequent build-side join key corresponding to the identifiedsecond frequent probe-side join key; and asynchronously distributing, bythe local server, the identified second frequent build-side row to asecond plurality of remote servers that frequently transmitted thesecond frequent build-side join key.
 23. The non-transitory computerreadable storage media of claim 21, wherein each of the plurality ofremote servers is configured to route probe-side rows having theidentified frequent probe-side join key for local processing on therespective remote server as part of processing the join operation. 24.The non-transitory computer readable storage media of claim 23, whereineach of the plurality of remote servers being configured to routeprobe-side rows having the identified frequent probe-side join key forlocal processing on the respective remote server as part of processingthe join operation comprises each of the plurality of remote serversbeing configured to alter an input link to route the probe-side rowshaving the identified frequent probe-side join key to a local instanceof the join operation.
 25. The non-transitory computer readable storagemedia of claim 21, the operations further comprising: computing, by thelocal server, a hash value for the join operation; selecting by thelocal server, a rowset comprising a plurality of rows of the joinoperation; and probing, by the local server, each of the plurality ofrows of the rowset into a space saving algorithm using the hash valuefor the join operation.
 26. The non-transitory computer readable storagemedia of claim 25, the operations further comprising: performing by thelocal server one or more updates to the space saving algorithm based onincoming data; and identifying, by the local server based on theperformed one or more updates to the space saving algorithm, a frequencyindicating how frequently the identified frequent probe-side join key isprobed.
 27. The non-transitory computer readable storage media of claim26, wherein asynchronously distributing the identified frequentbuild-side row to the plurality of remote servers is also in response tothe identified frequency exceeding a predetermined threshold.
 28. Thenon-transitory computer readable storage media of claim 25, theoperations further comprising: calculating, by the local server, a totalnumber of rows of the join operation that have been probed into thespace saving algorithm; calculating, by the local server, a thresholdper worker thread based on the total number of rows of the joinoperation that have been probed into the space saving algorithm; anddetermining, by the local server based on the threshold per workerthread, whether the frequent build-side join key is frequent among allthreads of at least one server among the local server and the pluralityof remote servers.
 29. The non-transitory computer readable storagemedia of claim 21, wherein identifying the frequent probe-side join keyon the probe side of the join operation during the probe phase of thejoin operation comprises identifying the frequent probe-side join key asbeing frequent to a threshold confidence level.
 30. The non-transitorycomputer readable storage media of claim 21, wherein the local serverdetects the data skew on the probe side of the join operation at theruntime of the join operation using a lightweight sketch data structure.